/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 网络平台服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const onlineServiceCompanyApi = urls.onlineServiceCompany

function listAllOnlineServiceCompany(success, complete) {
  postRequest(onlineServiceCompanyApi.listAllOnlineServiceCompany , {}, {}, success, complete)
}

function listOnlineServiceCompany(param, page, pageSize, success, complete) {
  postRequest(onlineServiceCompanyApi.listOnlineServiceCompany + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addOnlineServiceCompany(param, success, complete) {
  postRequest(onlineServiceCompanyApi.addOnlineServiceCompany, {}, param, success, complete)
}

function updateOnlineServiceCompany(id, param, success, complete) {
  postRequest(onlineServiceCompanyApi.updateOnlineServiceCompany + id, {}, param, success, complete)
}

function setWorkTemplate(id, templateId, success, complete) {
  postRequest(onlineServiceCompanyApi.setWorkTemplate + id, {templateId: templateId}, {}, success, complete)
}

function getOnlineServiceCompany(id, success, complete) {
  getRequest(onlineServiceCompanyApi.getOnlineServiceCompany + id, {}, success, complete)
}

function removeOnlineServiceCompany(ids, success, complete) {
  postRequest(onlineServiceCompanyApi.removeOnlineServiceCompany, {}, ids, success, complete)
}

function deleteSingleOnlineServiceCompany(id, success, complete) {
  let ids = []
  ids.push(id)
  removeOnlineServiceCompany(ids, success, complete)
}

export default {
  listAllOnlineServiceCompany,
  listOnlineServiceCompany,
  addOnlineServiceCompany,
  updateOnlineServiceCompany,
  setWorkTemplate,
  getOnlineServiceCompany,
  removeOnlineServiceCompany,
  deleteSingleOnlineServiceCompany
}
